<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FreeRTOS Addons: cpp_freertos::LockGuard Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">FreeRTOS Addons
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.5 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacecpp__freertos.html">cpp_freertos</a></li><li class="navelem"><a class="el" href="classcpp__freertos_1_1_lock_guard.html">LockGuard</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classcpp__freertos_1_1_lock_guard-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">cpp_freertos::LockGuard Class Reference</div></div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="mutex_8hpp_source.html">mutex.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a4eb7c1037e77dfb43618803011b92573"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_lock_guard.html#a4eb7c1037e77dfb43618803011b92573">LockGuard</a> (<a class="el" href="classcpp__freertos_1_1_mutex.html">Mutex</a> &amp;m)</td></tr>
<tr class="separator:a4eb7c1037e77dfb43618803011b92573"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acf9fd2e90ecd3b193b6292989a644c2c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classcpp__freertos_1_1_lock_guard.html#acf9fd2e90ecd3b193b6292989a644c2c">~LockGuard</a> ()</td></tr>
<tr class="separator:acf9fd2e90ecd3b193b6292989a644c2c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >Synchronization helper class that leverages the C++ language to help prevent deadlocks. This is a C++11 feature that allows <a class="el" href="classcpp__freertos_1_1_mutex.html">Mutex</a> Locking and Unlocking to behave following an RAII style. The constructor of this helper object locks the <a class="el" href="classcpp__freertos_1_1_mutex.html">Mutex</a>. The destructor unlocks the <a class="el" href="classcpp__freertos_1_1_mutex.html">Mutex</a>. Since C++ guarantees that an object's desctuctor is always called when it goes out of scope, calls to Unlock become unnecessary and are in fact guaranteed as long as correct scoping is used. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a4eb7c1037e77dfb43618803011b92573" name="a4eb7c1037e77dfb43618803011b92573"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4eb7c1037e77dfb43618803011b92573">&#9670;&#160;</a></span>LockGuard()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">LockGuard::LockGuard </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classcpp__freertos_1_1_mutex.html">Mutex</a> &amp;&#160;</td>
          <td class="paramname"><em>m</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p >Create a <a class="el" href="classcpp__freertos_1_1_lock_guard.html">LockGuard</a> with a specific <a class="el" href="classcpp__freertos_1_1_mutex.html">Mutex</a>.</p>
<dl class="section post"><dt>Postcondition</dt><dd>The <a class="el" href="classcpp__freertos_1_1_mutex.html">Mutex</a> will be locked. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>There is an infinite timeout for acquiring the Lock. </dd></dl>

</div>
</div>
<a id="acf9fd2e90ecd3b193b6292989a644c2c" name="acf9fd2e90ecd3b193b6292989a644c2c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acf9fd2e90ecd3b193b6292989a644c2c">&#9670;&#160;</a></span>~LockGuard()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LockGuard::~LockGuard </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p >Destroy a <a class="el" href="classcpp__freertos_1_1_lock_guard.html">LockGuard</a>.</p>
<dl class="section post"><dt>Postcondition</dt><dd>The <a class="el" href="classcpp__freertos_1_1_mutex.html">Mutex</a> will be unlocked. </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/<a class="el" href="mutex_8hpp_source.html">mutex.hpp</a></li>
<li>src/freertos-addon/c++/cmutex.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5
</small></address>
</body>
</html>
